<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateIssuesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::unprepared('
             CREATE TABLE `issues` (
                  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                  `journal_id` int(10) DEFAULT NULL,
                  `title` varchar(255) DEFAULT NULL,
                  `title_en` varchar(255) DEFAULT NULL,
                  `year` int(10) NOT NULL,
                  `volume` int(10) NOT NULL,
                  `issue` varchar(32) NOT NULL,
                  `page_start` int(10) NOT NULL,
                  `page_end` int(10) DEFAULT NULL,
                  `allow_member_download` tinyint(1) DEFAULT NULL,
                  `journal_created` date NOT NULL,
                  `journal_published` date NOT NULL,
                  `price` float DEFAULT NULL,
                  `journal_url` varchar(255) DEFAULT NULL,
                  `number` int(10) DEFAULT NULL,
                  `art_order` tinyint(1) DEFAULT NULL,
                  `is_special_issue` tinyint(1) DEFAULT NULL,
                  `cover` varchar(255) DEFAULT NULL,
                  `cover_en` varchar(255) DEFAULT NULL,
                  `content` text DEFAULT NULL,
                  `content_en` text DEFAULT NULL,
                  `created_at` timestamp NULL DEFAULT NULL,
                  `updated_at` timestamp NULL DEFAULT NULL,
                  `zr_id` int(10) DEFAULT NULL,
                  PRIMARY KEY (`id`)
                ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
            ');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('issues');
    }
}
